package com.yc.demo.test01;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.Arrays;

@WebServlet(name = "AddHobbyServlet", value = "/AddHobbyServlet")
public class AddHobbyServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        request.setCharacterEncoding("utf-8");
        response.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");

        String[] hobbies = request.getParameterValues("hobby");
        request.setAttribute("hobby",hobbies);
        HttpSession session = request.getSession();
        session.setAttribute("hobby",hobbies);
        response.sendRedirect("test/xueli.html");


    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
